package com.example.administrator.a009luckynumber;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import java.util.Random;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void doLuckyDraw(View v){
        //step 1
        TextView tv = (TextView)findViewById(R.id.luckyNumber);
        //step 2
        Random r = new Random();
        int n = r.nextInt(100) + 1;

        //step 3
        tv.setText(String.valueOf(n));

    }
}
